/*
 * @description: 帮助页面
 * @Author: @reynold 
 * @Date: 2025-03-25 11:37:30
 * @Update: 2025-03-25 11:37:30
 * @Version: V1.0.0
 */
<template>
  <div class="help-container">
    <h2 class="help-title">帮助中心</h2>
    <div class="help-content">
      <section class="help-section" @click="toggleFAQ">
        <h2>常见问题 <span class="toggle-icon">{{ showFAQ ? '−' : '+' }}</span></h2>
        <transition name="fade">
          <div class="faq-content" v-if="showFAQ">
            <div class="faq-item" v-for="(faq, index) in faqs" :key="index">
              <h3 @click.stop="toggleAnswer(index)" class="faq-question">
                {{ faq.question }} <span class="toggle-icon">{{ activeIndex === index ? '−' : '+' }}</span>
              </h3>
              <transition name="slide">
                <p class="faq-answer" v-if="activeIndex === index">{{ faq.answer }}</p>
              </transition>
            </div>
          </div>
        </transition>
      </section>
      
      <section class="help-section">
        <h2>联系我们</h2>
        <p>如需进一步帮助,请联系我们:homemaking@clean.com</p>
        <p>工作时间：周一至周五 9:00-18:00</p>
        <p>客服电话:400-123-4567</p>
      </section>
    </div>
  </div>
</template>

<script>
export default {
  name: 'HelpPage',
  data() {
    return {
      showFAQ: false,
      activeIndex: null,
      faqs: [
        {
          question: '如何注册账号？',
          answer: '点击登录界面的"没有账号？去注册"，填写用户名、密码等必要信息，点击“注册”按钮即可完成注册。'
        },
        {
          question: '怎么切换账号？',
          answer: '在我的页面点击"退出登录"，然后在登录页面选择其他账号登录即可。'
        },
        {
          question: '如何联系客服？',
          answer: '您可以通过页面底部的"联系我们"获取客服邮箱和电话,或直接发送邮件至homemaking@clean.com。'
        },
        {
          question: '支付方式有哪些？',
          answer: '我们支持支付宝、微信支付、银联卡和信用卡等多种支付方式。'
        }
      ]
    }
  },
  methods: {
    toggleFAQ() {
      this.showFAQ = !this.showFAQ
      if (!this.showFAQ) {
        this.activeIndex = null
      }
    },
    toggleAnswer(index) {
      this.activeIndex = this.activeIndex === index ? null : index
    }
  }
}
</script>

<style scoped>
.help-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  font-family: 'Arial', sans-serif;
  background-color: lightskyblue;
}

.help-title {
  color: #2c3e50;
  text-align: center;
  margin-bottom: 30px;
  font-size: 2.2rem;
}

.help-content {
  line-height: 1.6;
}

.help-section {
  margin-bottom: 30px;
  padding: 25px;
  background: #f9f9f9;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.3s ease;
}

.help-section:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.help-section h2 {
  color: #34495e;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.5rem;
}

.toggle-icon {
  font-size: 1.2rem;
  font-weight: bold;
}

.faq-content {
  margin-top: 15px;
  border-top: 1px solid #eee;
  padding-top: 15px;
}

.faq-item {
  margin-bottom: 15px;
}

.faq-question {
  color: #3498db;
  padding: 10px;
  background: #fff;
  border-radius: 5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.faq-question:hover {
  background: #f0f7fd;
}

.faq-answer {
  padding: 15px;
  background: #fff;
  border-left: 3px solid #3498db;
  margin-top: 5px;
  border-radius: 0 5px 5px 0;
}

/* 过渡动画 */
.fade-enter-active, .fade-leave-active {
  transition: opacity 0.3s;
}
.fade-enter, .fade-leave-to {
  opacity: 0;
}

.slide-enter-active {
  transition: all 0.3s ease;
}
.slide-leave-active {
  transition: all 0.3s ease;
}
.slide-enter, .slide-leave-to {
  transform: translateY(-10px);
  opacity: 0;
}

/*@media (max-width: 768px) {
  .help-container {
    padding: 15px;
  }
  
  .help-section {
    padding: 15px;
  }
  
  .help-title {
    font-size: 1.8rem;
  }
}*/
</style>